package com.klikmee.sms.chat.web.dao;

import javax.persistence.NoResultException;

import com.klikmee.sms.services.chat.model.Answer;

public class AnswerDAO extends AbstractDAO<Answer> {
	
	public AnswerDAO() {
		super(Answer.class);
	}
	
	public Answer findByResponseId(Long responseId){
		Answer result = null;
		try {
			result = (Answer) entityManager.createNamedQuery("Answer.findByCoreId").setParameter("coreId", responseId).getSingleResult();
		} catch (NoResultException e) {
			result = null;
		}
		return result;
	}
}